package com.appspot.redalert;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;

// This class listens the following click events:
// - continue button on the splash screen.
public class SplashScreen extends Dialog implements View.OnClickListener {

    private final Callbacks callback;

    private View continue_button;

    public SplashScreen(Context context, Callbacks callback) {
        super(context);
        this.callback = callback;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setTitle(R.string.app_name);

        setContentView(R.layout.splashscreen);

        // Install this class as a listener for click on the continue button.
        continue_button = findViewById(R.id.splashscreen_continue);
        continue_button.setOnClickListener(this);

    }

    /** {@inheritDoc} */
    public void onClick(View view) {
        if (view == continue_button) {
            callback.splashScreenDone();
            dismiss();
        }
    }
}
